﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AgvController
{
    interface IDataServer:IDisposable
    {
        ITag this[short id] { get; }
        ITag this[string name] { get; }
        //ExpressionEval Eval { get; }
        Object SyncRoot { get; }//对所有涉及集合更改项目使用；包括IGROUP的ADDITEMS
        IList<TagMetaData> MetaDataList { get; }
        //IList<Scaling> ScalingList { get; }
        IEnumerable<IDriver> Drivers { get; }
        IEnumerable<string> BrowseItems(BrowseType browseType, string tagName, DataType dataType);
        IDriver AddDriver(short id, string name, string assembly, string className);
        IGroup GetGroupByName(string name);
        int GetScaleByID(short id);
        int GetItemProperties(short id);//返回的是元数据在元数据列表的索引
        bool RemoveDriver(IDriver device);
        bool AddItemIndex(string key, ITag value);
        bool RemoveItemIndex(string key);
        void ActiveItem(bool active, params ITag[] items);
        int BatchWrite(Dictionary<string, object> tags, bool sync);
        //HistoryData[] BatchRead(DataSource source, bool sync, params ITag[] itemArray);
    }
    public enum BrowseType
    {
        Branch = 1,
        Leaf = 2,
        Flat = 3
    }
}
